//
//  WritingBaseViewController.m
//  TQY
//
//  Created by 甘世清 on 2024/9/28.
//

#import "WritingBaseViewController.h"
#import "HomeListViewController.h"
#import "HomeCopyWritingViewController.h"
@interface WritingBaseViewController ()
@property (nonatomic , strong) HomeListViewController * homeVC;
@property (nonatomic , strong) HomeCopyWritingViewController * copyVC;
@end

@implementation WritingBaseViewController

- (void)viewDidLoad {
    [super viewDidLoad];
  
    [self SQ_UIViewForSelfView];
}

- (void)SQ_UIViewForSelfView{
    
    UIImageView * bgImageView = [[UIImageView alloc]init];
    bgImageView.image = SQGetImage(@"二级背景");
    [self.view addSubview:bgImageView];
    [bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.view);
    }];
    self.tabContentView.backgroundColor = UIColor.clearColor;
    self.tabBar.backgroundColor = UIColor.clearColor;
    self.tabBar.leadingSpace = 10;
    self.tabBar.trailingSpace = 10;
    self.tabBar.indicatorColor  = SQColor3DA59D;
    [self.tabBar setIndicatorWidth:20 marginTop:42 marginBottom:6 tapSwitchAnimated:YES];
    [self setTabBarFrame:CGRectMake(30, TopHeight-50, SCREEN_WIDETH-60,50)
        contentViewFrame:CGRectMake(0, TopHeight, SCREEN_WIDETH, SCREEN_HEIGHT-TopHeight-FootHeight-40)];
    self.tabBar.itemTitleFont = FONT_SEMIBOLD(20);
    self.tabBar.itemTitleColor = SQColor(@"#999999");
    self.tabBar.itemTitleSelectedColor = SQColor3DA59D;
//    [self.tabContentView setContentScrollEnabled:YES tapSwitchAnimated:YES];
    self.tabContentView.loadViewOfChildContollerWhileAppear = YES;
    self.tabContentView.backgroundColor = UIColor.clearColor;
    self.viewControllers = [[NSMutableArray alloc]initWithObjects:self.homeVC,self.copyVC, nil];
    [self.view sendSubviewToBack:bgImageView];
}
- (HomeListViewController *)homeVC{
    if (!_homeVC) {
        _homeVC = [[HomeListViewController alloc]init];
//        _homeVC.yp_tabItemImage = SQGetImage(@"图标-未选中-4");
//        _homeVC.yp_tabItemSelectedImage = SQGetImage(@"图标-选中-4");
        _homeVC.yp_tabItemTitle = SQNSLocalString(@"热门");
    }
    return _homeVC;
}
- (HomeCopyWritingViewController *)copyVC{
    if (!_copyVC) {
        _copyVC = [[HomeCopyWritingViewController alloc]init];
//        _copyVC.yp_tabItemImage = SQGetImage(@"图标-未选中");
//        _copyVC.yp_tabItemSelectedImage = SQGetImage(@"图标-选中");
        _copyVC.yp_tabItemTitle = SQNSLocalString(@"发现");
    }
    return _copyVC;
}

@end
